package org.openstock.impl.def.charting.ui.swing.presenter.delegate.builder;

import org.openstock.api.charting.presenter.delegate.builder.ViewBuilder;
import org.openstock.impl.def.charting.ui.swing.view.DefaultStockChartView;
import org.openstock.impl.def.charting.ui.swing.view.DefaultStockMultiChartView;
import org.openstock.impl.def.core.factory.Factory;

public class DefaultStockMultiChartViewBuilder implements ViewBuilder<DefaultStockMultiChartView> {

	
	private DefaultStockChartViewBuilder defaultStockChartViewBuilder;

	public DefaultStockMultiChartViewBuilder() {
		defaultStockChartViewBuilder = Factory.getSingleton(DefaultStockChartViewBuilder.class);
	}
	
	@Override
	public DefaultStockMultiChartView build() {
		DefaultStockMultiChartView multiView = buildInternal();
		DefaultStockChartView view = defaultStockChartViewBuilder.build();
		multiView.addChild(view);
		return multiView;
	}
	
	private DefaultStockMultiChartView buildInternal(){
		return Factory.getPrototype(DefaultStockMultiChartView.class);
	}
	
}
